package com.iterative.system.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.iterative.common.persistence.HibernateDao;
import com.iterative.common.service.BaseService;
import com.iterative.system.dao.RoleDao;
import com.iterative.system.entity.Role;

@Service
@Transactional(readOnly=true)
public class RoleService extends BaseService<Role, Long>{
	
	@Autowired
	private RoleDao roleDao;

	@Override
	public HibernateDao<Role, Long> getEntityDao() {
		return roleDao;
	}

	/**
	 * 获取角色通过ids
	 * @param ids
	 * @return
	 */
	public List<Role> getRolesById(List<Long> ids) {
		return roleDao.find(ids);
	}

	/**
	 * 通过角色名字获取角色
	 * @param name
	 * @return
	 */
	public Role getRoleByName(String name) {
		return roleDao.findUniqueBy("name", name);
	}



	

}
